﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Diploma.Models.OrderPractice>>" %>

<script language="javascript">
    function DeleteOrder(url) {
        if (confirm("Уверены, что хотите удалить приказ?")) {
            parent.location = url;
        }
    }
</script>
<table>
    <tr>
        <th>
        </th>
        <th>
            <%: Html.ResourceCtrl("lbl_Name", "~/Views/SystemManagers/OrderPractice/OrderList.ascx")%>
        </th>
        <th>
            <%: Html.ResourceCtrl("lbl_DateOfCreate", "~/Views/SystemManagers/OrderPractice/OrderList.ascx")%>
        </th>
        <th>
            <%: Html.ResourceCtrl("lbl_LastChange", "~/Views/SystemManagers/OrderPractice/OrderList.ascx")%>
        </th>
        <th>
            <%: Html.ResourceCtrl("lbl_IsVerified", "~/Views/SystemManagers/OrderPractice/OrderList.ascx")%>
        </th>
    </tr>
    <%
        foreach (OrderPractice item in Model)
        {%>
    <tr>
        <td>
            <a href="<%:Url.RouteUrl("Default", new
                                                  {
                                                      action = "Room", 
                                                      controller = "OrderPractice", 
                                                      orderId = item.Id
                                                  })%>" class="order_link" style="margin: 5px;">
                <img src="<%: Url.Content("~/Content/Icons/edit-info.png") %>" height="15" width="15"/>
            </a>
            <% if (item.IsVerify.HasValue && !item.IsVerify.Value) { %>
                <img src="<%: Url.Content("~/Content/Icons/delete.png") %>" height="15" width="15" onclick="DeleteOrder('<%: Url.RouteUrl("Default", new
                                                    {
                                                        action = "DeleteOrderPractice",
                                                        controller = "OrderPractice",
                                                        orderId = item.Id
                                                    }) %>'); return false;"/>
            <% } %>
        </td>
        <td>
            <%:item.Name%>
        </td>
        <td>
            <%:item.CreateDate%>
        </td>
        <td>
            <%:item.UpdateDate%>
        </td>
        <td>
            <%:item.IsVerify%>
        </td>
    </tr>
    <%
        }%>
</table>
